<?php
interface Product{
    public function beProduced();
    public function beSelled();
}

class House implements Product{

    public function beProduced(){
        echo "produce house</br>";
    }

    public function beSelled(){
        echo "house sell</br>";
    }
}

class IPad implements Product{

    public function beProduced(){
        echo "produce ipad</br>";
    }

    public function beSelled(){
        echo "ipad sell</br>";
    }
}

class Cloth implements Product{

    public function beProduced(){
        echo "produce cloth</br>";
    }

    public function beSelled(){
        echo "cloth sell</br>";
    }
}

class Corp{
    private $product;

    public function __construct(Product $product){
        $this->product=$product;
    }

    public function makeMoney(){
        $this->product->beProduced();
        $this->product->beSelled();
    }
}

class HouseCorp extends Corp{

    public function __construct(Product $product){
        parent::__construct($product);
    }

    public function makeMoney(){
        parent::makeMoney();
        echo "house makemoney</br>";
    }
}

class ShanZhaiCorp extends Corp{

    public function __construct(Product $product){
        parent::__construct($product);
    }

    public function makeMoney(){
        parent::makeMoney();
        echo "sanZhai makemoney</br>";
    }
}

class Client{

    public function __construct(){
        echo "**********************house*******************</br>";
        $house=new House();
        $houseCrop=new HouseCorp($house);
        $houseCrop->makeMoney();

        echo "**********************Ipad*******************</br>";
        $ipad=new IPad();
        $shanZhai=new ShanZhaiCorp($ipad);
        $shanZhai->makeMoney();

        echo "**********************close*******************</br>";
        $cloth=new Cloth();
        $shanZhai2=new ShanZhaiCorp($cloth);
        $shanZhai2->makeMoney();
    }
}


new Client();
?>